package domain;

import cn.hutool.core.util.ReUtil;

public class SysUser {
    private String userName;
    private String pwd;
    private String tel;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    @Override
    public String toString() {
        return "SysUser{" +
                "userName='" + userName + '\'' +
                ", pwd='" + pwd + '\'' +
                ", tel='" + tel + '\'' +
                '}';
    }

    public static Boolean isValidPassword(String pwd){
        return ReUtil.isMatch("^(?=.*[A-Za-z]).{8,}$", pwd);
    }

    public static Boolean equalsPassword(String pwd1, String pwd2){
        return pwd1.equals(pwd2);
    }

    public static Boolean isValidPhoneNumber(String phone){
        return ReUtil.isMatch("^(19|14|15|18|13)[0-9]{9}$", phone);
    }

}
